﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddressLookupControl.ascx.cs" Inherits="SD.Web.Controls.Lookup.AddressLookupControl" %>


<asp:Panel runat="server" ID="PanelContainer" CssClass="" Visible="false">
    <%--<asp:UpdatePanel ID="ContactListUpdatePanel" runat="server">
        <ContentTemplate>--%>
    <div class="grid740 simplebox popup">
        <div class="titleh">
            <h3>Search Postcode</h3>
        </div>
        <div class="body">
            <div class="st-form-line">
                <div class="half level2">
                    <asp:Label ID="lbllPostcode" runat="server" Text="Postcode" 
                        AssociatedControlID="txtPostcode"></asp:Label>
                    <asp:TextBox ID="txtPostcode" runat="server" CssClass="st-forminput" 
                                 Width="100px"></asp:TextBox>
                </div>
                <div class="half level2-5">
                    <asp:Label ID="lblBoxStreet" runat="server" Text="Street" 
                        AssociatedControlID="txtStreet"></asp:Label>
                    <asp:TextBox ID="txtStreet" runat="server" CssClass="st-forminput" 
                                 Width="160px"></asp:TextBox>
                </div>
                <div class="half level2">
                    <asp:Label ID="lblBoxTown" runat="server" Text="Town" 
                        AssociatedControlID="txtTown"></asp:Label>
                    <asp:TextBox ID="txtTown" runat="server" CssClass="st-forminput" 
                                 Width="100px"></asp:TextBox>
                </div>
                <div class="clear">
                </div>
            </div>
            <div class="button-box">
                <asp:Button ID="cmdSearch" runat="server" Text="Search Address" CssClass="st-button"
                            OnClick="cmdSearch_Click" CausesValidation="False" />
                <asp:Button ID="cmdNone" runat="server" Text="None" CssClass="st-button" 
                    OnClick="cmdNone_Click" CausesValidation="False" />
                <asp:Button ID="cmdClear" runat="server" Text="Clear" CssClass="st-button" 
                    OnClick="cmdClear_Click" CausesValidation="False" />
            </div>
            <div class="st-form-line">
                <div class="titleh">
                </div>
                <asp:GridView ID="grvSearchPostcode" runat="server" CssClass="tablesorter" 
                    AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True"
                              DataKeyNames="AddressId" PageSize="5" 
                    DataSourceID="PostCodeObjectDataSource">
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <input id="RadioButton" name="RadioButton" type="radio" value="<%# Eval("AddressId") %>"/>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField HeaderText="Address" DataField="AddressLine" SortExpression="Address">
                            <HeaderStyle HorizontalAlign="Left" CssClass="header" />
                        </asp:BoundField>
                        <asp:BoundField HeaderText="Post Code" DataField="PostCode" SortExpression="PostCode">
                            <HeaderStyle HorizontalAlign="Left" CssClass="header" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="Town" SortExpression="Town">
                            <ItemTemplate>
                                <%#Eval("Town.TownName")%>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" CssClass="header" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="County" SortExpression="County">
                            <ItemTemplate>
                                <%#Eval("Town.County.CountyName")%>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" CssClass="header" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Country" SortExpression="Country">
                            <ItemTemplate>
                                <%#Eval("Town.County.Country.CountryName")%>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" CssClass="header" />
                        </asp:TemplateField>
                    </Columns>
                    <PagerSettings Mode="NextPreviousFirstLast" />
                    <PagerStyle CssClass="pagination_table" />
                </asp:GridView>

               

                <asp:ObjectDataSource ID="PostCodeObjectDataSource" runat="server" SelectMethod="LookupPostcodes"
                                      TypeName="SD.Business.LookupController" EnablePaging="true" SelectCountMethod="GetLookupPostCodeCount"
                                      
                                      StartRowIndexParameterName="startRowIndex"
                                      SortParameterName="sort" 
                    OnSelecting="PostCodeObjectDataSource_Selecting">

                    <SelectParameters>
                        <asp:Parameter Name="filter" Type="Object" ConvertEmptyStringToNull="False" />
                    </SelectParameters>
                </asp:ObjectDataSource>

               

                <br />
                <div class="">
                    <asp:Button ID="cmdSelect" runat="server" Text="Select" CssClass="st-button" 
                        OnClick="cmdSelect_Click" CausesValidation="False" />
                    <asp:Button ID="cmdClose" runat="server" Text="Close" CssClass="st-button" 
                        OnClick="cmdClose_Click" CausesValidation="False" />
                </div>
            </div>
        </div>
    </div>
    <%--</ContentTemplate>
    </asp:UpdatePanel>--%>
    <div class="clear">
    </div>
</asp:Panel>